package com.fatiny.core.db.po;

/**
 * 成员变量基本信息
 * @author Administrator
 *
 */
public class Properties {
	
	private String field; // Java字段
	private String desc; // 描述
	private String type; // 类型
	
	/**
	 * 泛型类型, List,Map的泛型类型
	 */
	private String genericType; 
	
	public Properties() {
		
	}
	
	public Properties(String field, String desc, String type) {
		super();
		this.field = field;
		this.desc = desc;
		this.type = type;
	}

	public String getField() {
		return field;
	}

	public void setField(String field) {
		this.field = field;
	}

	public String getDesc() {
		return desc;
	}

	public void setDesc(String desc) {
		this.desc = desc;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
		
		if (this.type.startsWith("List<")) {
			//List<Integer>
			int begin = this.type.indexOf("<");
			int end = this.type.indexOf(">");
			this.genericType = this.type.substring(begin+1, end);//截取复杂类型的泛型类
		}else if (this.type.startsWith("Map<")) {
			//Map<Integer, Integer>
			String tem = this.type.replace(" ", "");
			int begin = tem.indexOf(",");
			int end = tem.indexOf(">");
			this.genericType = tem.substring(begin+1, end);//截取复杂类型的泛型类
		}
	}
	
	public String getGenericType() {
		return genericType;
	}

	public void setGenericType(String genericType) {
		this.genericType = genericType;
	}

	@Override
	public String toString() {
		return "Properties [field=" + field + ", desc=" + desc + ", type=" + type + "]";
	}
	
}
